<?php
function format_size($size, $round = 3) {
    $sizes = array('B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB');
    for ($i=0; $size > 1024 && isset($sizes[$i+1]); $i++) $size /= 1024;
    return round($size,$round).$sizes[$i];
}
function dir_size($dir, $size = 0) {
    $handle = opendir($dir);

    while ($file = readdir($handle)) {
        if ($file == '.' || $file == '..') continue;

        $full_path = "$dir/$file";

        if (is_dir($full_path)) {
            $size = dir_size($full_path.'/', $size);
        } else {
            $size += filesize($full_path);
        }
    }

    closedir($handle);

    return "$size";
}

function resize ($text)
{
if (strlen($text)>50) {
      $text1 = explode("|&|",chunk_split($text,"50","|&|"));
      $text1n = $text1[0];
      $newtext = $text1n . "...";
	return "$newtext";
   }
	else
	return "$text";
}
?>
